package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Weibo;
import cn.tedu._04mybatis.pojo.vo.*;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WeiboMapper {
//    @Insert("INSERT INTO weibo(content,created,user_id) VALUES " +
//            "(#{content},#{created},#{userId})")
    void insertWeibo(Weibo weibo);

    /**
     * 删除微博
     */
//    @Delete("DELETE FROM weibo WHERE id=#{weiboId}")
    int deleteWeibo(Long weiboId);

    /**
     * 修改微博
     */
//    @Update("UPDATE weibo SET content = #{content},created = #{created},user_id = #{userId} WHERE id = #{id}")
    int updateWeibo(Weibo weibo);

    /**
     * 查询微博
     */
//    @Select("SELECT id,content,created,user_id userId FROM weibo WHERE id = #{weiboId}")
    Weibo selectWeibo(Long weiboId);

    /**
     * 查询多条微博
     */
//    @Select("SELECT id,content,created,user_id userId FROM weibo")
    List<Weibo> selectWeibos();

//    @Select("SELECT content,created FROM weibo WHERE id = #{weiboId}")
    SelectWeiboVO1 selectWeiboVO1(Long weiboId);

//    @Select("SELECT id,content FROM weibo WHERE user_id = #{userId}")
    List<SelectWeiboVO2> selectWeiboVO2(Long userId);

    int dynamicUpdateWeibo(Weibo weibo);

    int dynamicDeleteWeibo1(Long[] ids);

    int dynamicDeleteWeibo2(List<Long> ids);

    int selectCount();

    ResultMapVO1 selectResultMapVO1(Long weiboId);

    ResultMapVO2 selectResultMapVO2(Long userId);

    ResultMapVO3 selectResultMapVO3(Long weiboId);

    ResultMapVO4 selectResultMapVO4(Long weiboId);
}
